//
//  KHProgressHUD.m
//  KissHealth
//
//  Created by bingo on 2018/12/10.
//  Copyright © 2018 Mark. All rights reserved.
//

#import "KHProgressHUD.h"
#import <SVProgressHUD/SVProgressHUD.h>

@implementation KHProgressHUD

+ (void)load {
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeNone];
    [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
    [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
    [SVProgressHUD setInfoImage:[UIImage imageNamed:@""]];
    [SVProgressHUD setMinimumDismissTimeInterval:5];
    [SVProgressHUD setMaximumDismissTimeInterval:5];
    
}

+ (void)show {
    [SVProgressHUD show];
}

+ (void)dismiss {
    [SVProgressHUD dismiss];
}

+ (void)showInfoWithStatus:(NSString *)status {
    [SVProgressHUD showInfoWithStatus:status];
}

+ (void)showAlertWithInfo:(NSString *)message {
    [self showAlertWithInfo:message actionTitle:@"OK" fromViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}

+ (void)showAlertWithInfo:(NSString *)message actionTitle:(NSString *)actionTitle {
    [self showAlertWithInfo:message actionTitle:actionTitle fromViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}

+ (void)showAlertWithInfo:(NSString *)message actionTitle:(NSString *)actionTitle fromViewController:(UIViewController *)fromViewController {
    
    UIAlertController *alert = [UIAlertController
                                alertControllerWithTitle:nil
                                message:message
                                preferredStyle:UIAlertControllerStyleAlert];
    
    //Add Buttons
    UIAlertAction *yesButton = [UIAlertAction
                                actionWithTitle:actionTitle
                                style:UIAlertActionStyleDefault
                                handler:^(UIAlertAction * action) {
                                    //Handle your ok please button action here
                                    [alert dismissViewControllerAnimated:YES completion:nil];
                                }];
    
    //Add your buttons to alert controller
    [alert addAction:yesButton];
    [fromViewController presentViewController:alert animated:YES completion:nil];
    
}

@end
